// packageH/project_verification/components/storeItem/storeItem.js
const app = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    data: {
      type: Object,
    },
    toDetails: {
      // 跳转到详情
      type: Boolean,
      value: true,
    },
    showTel:{
      type:Boolean,
      value:false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {},

  /**
   * 组件的方法列表
   */
  methods: {
    openMap() {
      let point = app.BMapTransqqMap(parseFloat(this.data.data.store_longitude), parseFloat(this.data.data.store_latitude));
      wx.openLocation({
        latitude: point.lat,
        longitude: point.lng,
        scale: 18,
      });
    },
    toStoreDetails() {
      if (this.data.toDetails === false) {
        return;
      }
      if (this.data.data.store_type == 2) {
        wx.navigateTo({
          url: "/packageC/hotel/HotelHome/HotelHome?id=" + this.data.data.id,
        });
      } else {
        let urls = `/packageC/o2o/HomeSeller/HomeSeller?store_id=${this.data.data.id}`
        let store_projects = wx.getStorageSync('yz_basic_info')?.plugin_setting?.store_projects;
        if (store_projects?.store_jump_set == 1){
          urls += '&store_jump_set=1'
        }
        wx.navigateTo({
          url: urls,
        });
      }
    },
    tapTelPhone(e){
      let {item} = e.currentTarget.dataset;
      wx.makePhoneCall({
        phoneNumber: item.mobile,
      })
    }
  },
});
